<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>app/controllers/application_controller.rb</title>
    <link href="screen.css" media="all" rel="stylesheet" type="text/css" />
    <link href="print.css" media="print" rel="stylesheet" type="text/css" />
    
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <script type="text/javascript" src="rcov.js"></script>
  </head>
  <body>
    <h1>Survey0 3 C0 Coverage Information - RCov</h1>
    <h2>app/controllers/application_controller.rb</h2>

    

    <div class="report_table_wrapper">
      <table class='report' id='report_table'>
        <thead>
          <tr>
            <th class="left_align">Name</th>
            <th class="right_align">Total Lines</th>
            <th class="right_align">Lines of Code</th>
            <th class="left_align">Total Coverage</th>
            <th class="left_align">Code Coverage</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td class="left_align"><a href="app-controllers-application_controller_rb.html">app/controllers/application_controller.rb</a></td>
            <td class='right_align'><tt>67</tt></td>
            <td class='right_align'><tt>41</tt></td>
            <td class="left_align"><div class="percent_graph_legend"><tt class=''>40.30%</tt></div>
          <div class="percent_graph">
            <div class="covered" style="width:40px"></div>
            <div class="uncovered" style="width:60px"></div>
          </div></td>
            <td class="left_align"><div class="percent_graph_legend"><tt class=''>21.95%</tt></div>
          <div class="percent_graph">
            <div class="covered" style="width:22px"></div>
            <div class="uncovered" style="width:78px"></div>
          </div></td>
          </tr>
        </tbody>
      </table>
    </div>
    
    <h3>Key</h3>
    
    <div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>

    <h3>Coverage Details</h3>

    <table class="details">
      <tbody>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line1">1</a> # Filters added to this controller apply to all controllers in the application.</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line2">2</a> # Likewise, all the methods added will be available for all controllers.</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line3">3</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line4">4</a> class ApplicationController &lt; ActionController::Base</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line5">5</a>   #include SimpleCaptcha::ControllerHelpers</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line6">6</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line7">7</a>   helper :all # include all helpers, all the time</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line8">8</a>   #protect_from_forgery :secret =&gt; &quot;fjdksla;fnkfndls;afdsagfdfdsaaaaaaaaaaaaacvc54354354365&quot;</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line9">9</a>   skip_before_filter :verify_authenticity_token</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line10">10</a>   # Scrub sensitive parameters from your log</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line11">11</a>   # filter_parameter_logging :password</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line12">12</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line13">13</a>   def index</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line14">14</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line15">15</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line16">16</a>   def auth</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line17">17</a>     #从session 中取出 user</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line18">18</a>     permissed=false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line19">19</a>     current_user_id = session[CURRENT_USER_ID]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line20">20</a>     #记住用户请求的路径,以便登录后自动跳转到用户请求的页面</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line21">21</a>     session[:go_where] = request.request_uri</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line22">22</a>     if current_user_id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line23">23</a>       # 在user_roles 表中找出 用户所有的 role</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line24">24</a>       user_role=UserRole.find(:all , :conditions =&gt; {:user_id=&gt; session[CURRENT_USER_ID]})</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line25">25</a>       for ur in user_role</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line26">26</a>         # 找出每一个角色的权限controller</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line27">27</a>         permissions = Permisssion.find(:all , :conditions =&gt; {:role_id =&gt; ur.role_id})</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line28">28</a>         for p in permissions</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line29">29</a>           if controller_name  == p.url</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line30">30</a>             permissed=true</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line31">31</a>           end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line32">32</a>         end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line33">33</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line34">34</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line35">35</a>       if permissed</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line36">36</a>         #go on</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line37">37</a>       else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line38">38</a>         redirect_to &quot;/home/impermission&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line39">39</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line40">40</a>       8888</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line41">41</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line42">42</a>       redirect_to :controller=&gt;&quot;/login&quot; ,:action=&gt;&quot;login&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line43">43</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line44">44</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line45">45</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line46">46</a>   #用户信息完整性判断过滤</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line47">47</a>   def complete_user_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line48">48</a>     @current_user_id = session[CURRENT_USER_ID]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line49">49</a>     if !User.info_completed?(@current_user_id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line50">50</a>       redirect_to(:controller=&gt;&quot;login&quot; , :action=&gt;&quot;update&quot; ,:id =&gt; @current_user_id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line51">51</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line52">52</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line53">53</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line54">54</a>   #当前登录的用户</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line55">55</a>   def current_user</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line56">56</a>     session[CURRENT_USER_ID] ? User.find(session[CURRENT_USER_ID]) : nil</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line57">57</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line58">58</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line59">59</a>   def count_by_formula(number, formula)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line60">60</a>     #如： count_by_formual(2, &quot;*5&quot;) , return =&gt; 2*5=10</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line61">61</a>     eval &quot;#{number}.#{formula[0,1]} #{formula[1, formula.length]}&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line62">62</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line63">63</a>  </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line64">64</a> end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line65">65</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line66">66</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line67">67</a> </pre></td>
          </tr>
        
      </tbody>
    </table>

    <p>Generated on Wed Mar 17 14:12:44 +0800 2010 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>

  </body>
</html>
